package ru.paswd.marketprice.rest.app.repositories;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import ru.paswd.marketprice.rest.app.entity.Product;
import ru.paswd.marketprice.rest.app.entity.ProductCategory;

import java.util.Optional;
import java.util.UUID;

public interface ProductsRepository extends PagingAndSortingRepository<Product, UUID> {
    Optional<Product> findByName(String name);
    Page<Product> findAllByCategory(ProductCategory category, Pageable pageable);
    Page<Product> findAllByNameContains(String name, Pageable pageable);
    Page<Product> findAllByNameContainsAndCategory(String name, ProductCategory category, Pageable pageable);
}
